home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 52
/
Aminet 52 (2002)(GTI - Schatztruhe)[!][Dec 2002].iso
/
Aminet
/
game
/
patch
/
WHDIGamesC-D.lzh
/
Deflektor.lha
/
Deflektor
/
deflektorimager.asm
< prev
next >
Wrap
Assembly Source File
|
1997-07-12
|
6KB
|
346 lines
INCDIR ASM-ONE:INCLUDE2.0/
INCLUDE OWN/Patcher.I
INCLUDE DEVICES/TRACKDISK.I
INCLUDE EXEC/EXEC_LIB.I
INCLUDE EXEC/IO.I
INCLUDE LIBRARIES/DOS_LIB.I
INCLUDE LIBRARIES/FILEHANDLER.I
INCDIR ASM-ONE:OWN/PATCHER/PARAMQTX/
HP MOVEQ.L #20,D0
RTS
DC.L TAB
DC.B 'PTCH'
DC.B '$VER:Deflektor_Diskimager_V1.00',0
EVEN
TAB DC.L PCH_INIT,INITROUT
DC.L PCH_FILECOUNT,1
DC.L PCH_ADAPTOR,ADNAME
DC.L PCH_DISKNAME,DISKNAMEARRAY
DC.L PCH_FILENAME,FILENAMEARRAY
DC.L PCH_CHANGES,CHANGESARRAY
DC.L PCH_NAME,PARAMNAME
DC.L PCH_DATALENGTH,LENGTHTABLE
DC.L PCH_SPECIAL,SPECIALARRAY
DC.L PCH_STATE,STATEARRAY
DC.L PCH_STATE2,STATEARRAY2
DC.L PCH_MINVERSION,VERSNAME ;minimum version of THE PATCHER
DC.L 0
;minimum version of the patcher required, uses driveinhibit
VERSNAME DC.B 'V1.02' ;MAY NOT CONTAIN HEADING ZEROES
EVEN ;MUST CONTAIN 2 NUMBERS AFTER POINT
ADNAME DC.B 'Done by Harry.',0
EVEN
PARAMNAME
DC.B 'Deflektor, Diskimager for HD-install',0
EVEN
DISKNAMEARRAY DC.L DISK1NAME
DISK1NAME DC.B 'Deflektor',0
EVEN
FILENAMEARRAY
DC.L FILENAME
FILENAME DC.B 'disk.1',0
EVEN
LENGTHTABLE ;DC.L $400
DC.L 3*$7D0*$42
CHANGESARRAY DC.L 0 ;no changes to make in all cycles
; DC.L 0 ;(why the hell is that table included?)
;the parameter-initializing opens sourcedevice
INITROUT
; MOVE.B #'1',DISKNR
; MOVE.B #'1',DISKNR2
MOVEQ.L #0,D0
MOVE.L PTB_OPENDEVICE(A5),A0
JSR (A0)
TST.L D0
RTS
;loading-statetexts for the cycles
STATEARRAY ;DC.L LOADSTATE2
LOADSTATE2
DC.B 'Please insert your original writepro-',$A
DC.B 'tected disk '
disknr dc.b 'in the source drive.',0
EVEN
STATEARRAY2 DC.L SAVESTATE
SAVESTATE
DC.B 'Please insert your destination disk.',0
EVEN
;routines to 'load' something
SPECIALARRAY DC.L LOADROUT ;load stuff from original
LOADROUT
MOVEQ.L #0,D7
MOVEQ.L #0,D0
MOVE.L PTB_INHIBITDRIVE(A5),A0
JSR (A0)
.NEU
.4 MOVE.L PTB_DEVICESOURCEPTR(A5),A1
MOVE.W #TD_CHANGESTATE,IO_COMMAND(A1)
MOVE.L (_SYSBASE).W,A6
JSR _LVODOIO(A6)
TST.L IO_ACTUAL(A1)
BNE.W .NOTORG
MOVE.L PTB_ADDRESSOFFILE(A5),A4 ;load first part of disk
LEA.L (A4),A2 ;offset to load in the dataspace
MOVEQ.L #2,D2 ;starttrack on the disk
MOVE.L PTB_FILESIZE(A5),D3 ;bytes to read
MOVEQ.L #0,D4 ;data from the start of the track
; bra.s .5 ;because reading starts with
;trackstart, this is obsolete
.3 TST.L D4
BNE.W .1
.5 CMP.W #$32,D0 ;SKIP TRACK 32
BNE.S .NOSK
MOVEQ.L #$33,D0
LEA.L $1770(A2),A2
.NOSK
MOVEQ.L #$4,D5 ;4 tries, then error
.55
MOVE.L PTB_DEVICESOURCEPTR(A5),A1
MOVE.L PTB_SPACE(A5),IO_DATA(A1) ;track is to load in PTB_SPACE
MOVE.L #$7C00,IO_LENGTH(A1) ;double length of track
;to decode the index-sync-read data
;my own trackcounter
MOVE.L D2,D0
EOR.B #1,D0
MOVE.L D0,IO_OFFSET(A1)
MOVE.W #TD_RAWREAD,IO_COMMAND(A1)
MOVE.B #IOTDB_INDEXSYNC,IO_FLAGS(A1)
MOVE.L (_SYSBASE).W,A6
JSR _LVODOIO(A6)
TST.L D0
BNE.W .ERR
MOVE.L PTB_SPACE(A5),A0
LEA.L $7C00(A0),A1 ;end of buffer
LEA.L $7C00(A0),A3
BSR.W TRACKDECODE
TST.L D0
BEQ.S .R1OK
DBF D5,.55
BRA.W .NOTORG
.R1OK
; CMP.W #2,D2 ;DISKCHECK
; BNE.S .R3OK
; MOVE.L A3,A0
; CMP.L #$4DF900DF,(A0)
; BEQ.S .R2OK
; BRA.W .NOTORG
.R2OK
ST D7 ;correct disk - nothing anymore
;to change
.R3OK ADDQ.L #1,D2
.1 MOVE.B (A3)+,(A2)+
ADDQ.L #1,D4
CMP.L #$7D0*3,D4 ;tracklength
BNE.S .2
MOVEQ.L #0,D4 ;new track
.2 SUBQ.L #1,D3
BNE.W .3
MOVEQ.L #0,D4
.END
MOVE.L PTB_DEVICESOURCEPTR(A5),A1 ;switch motor off
MOVE.L #0,IO_LENGTH(A1)
MOVE.W #TD_MOTOR,IO_COMMAND(A1)
MOVE.L (_SYSBASE).W,A6
JSR _LVODOIO(A6)
MOVEQ.L #0,D0
MOVE.L PTB_ENABLEDRIVE(A5),A0
JSR (A0)
MOVE.L D4,D0
RTS
.ERR MOVEQ.L #-1,D4
BRA.S .END
.NOTORG TST.L D7 ;if the first time the original
BNE.S .ERR ;was not in the source drive,
ST D7 ;youll be asked to put it there
MOVE.L PTB_DEVICESOURCEPTR(A5),A1 ;motor off
MOVE.L #0,IO_LENGTH(A1)
MOVE.W #TD_MOTOR,IO_COMMAND(A1)
MOVE.L (_SYSBASE).W,A6
JSR _LVODOIO(A6)
LEA.L LINE1(PC),A0
LEA.L LINE2(PC),A1
MOVE.L PTB_REQUEST(A5),A6
JSR (A6)
TST.L D0
BNE.S .ERR
BRA.W .NEU
;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!11
LINE1 DC.B 'Please insert your original',0
EVEN
LINE2 DC.B 'disk '
DISKNR2 DC.B 'in the source drive.',0
EVEN
DECODE1BYTE
MOVE.L (A2),D0
ADDQ.L #2,A2
LSR.L D5,D0
AND.L D3,D0
MOVEQ.L #$8-1,D2
.1 LSL.W #2,D0
ROXL.B #1,D1
DBF D2,.1
MOVE.B D1,D0
RTS
;< A0 RAWTRACK
;< A1 TRACKBUFFER
;> D0 ERROR
SYNC DC.W $4489
GETSYNC
;SYNCANFANG SUCHEN
MOVE.W SYNC(PC),D1
.SHF2 MOVEQ.L #$10-1,D5
.SHF1 MOVE.L (A2),D0
LSR.L D5,D0
CMP.W D1,D0
BEQ.S .SY
DBF D5,.SHF1
ADDQ.L #2,A2
CMP.L A2,A4
BHI.S .SHF2
BRA.S .ERR
.SY
.1 MOVE.L (A2),D0
ADDQ.L #2,A2
LSR.L D5,D0
CMP.W D1,D0
BEQ.S .1
SUBQ.L #2,A2
CMP.L A2,A4
BLS.S .ERR
MOVEQ.L #0,D0
RTS
.ERR MOVEQ.L #-1,D0
RTS
;< A0 RAWTRACK
;< A1 TRACKBUFFER
;> D0 ERROR
;INTERN
; D5 SHIFT
; D7 SEKTORANZAHL
TRACKDECODE MOVEM.L A2/A3/A4/A5/D2/D3/D4/D5/D6/D7,-(A7)
MOVE.L A0,A2
LEA.L $7C00(A0),A4
;FUER JEDEN UNGELADENEN SEKTOR 1 BIT IN D7
MOVE.L #%111,D7
.NEXTSEC
.ANF MOVE.L #$55555555,D3
BSR.W GETSYNC
TST.L D0
BNE.W .ERR
;$10 BYTES NACH ANFANG
.DECHEAD
MOVEQ.L #$5-1,D4
LEA.L HEADER,A3
.GETHEADER
BSR.W DECODE1BYTE
MOVE.B D0,(A3)+
DBF D4,.GETHEADER
CMP.B #$FF,HEADER
BNE.S .ANF
CMP.B #2,HEADER+2
BHI.S .ANF
;SECTORDATEN DEKODIEREN
;SEKTORNUMMER HOLEN
MOVEQ.L #0,D0
MOVE.B HEADER+2,D0
BCLR D0,D7
MULU #$7D0,D0
LEA.L 0(A1,D0.L),A3
.DECSEC
MOVE.L #$7D0-1,D4
.DECSEC1 BSR.W DECODE1BYTE
MOVE.B D0,(A3)+
DBF D4,.DECSEC1
;SECCHECKSUM PRUEFEN
MOVE.B HEADER+3,D4
LSL.W #8,D4
MOVE.B HEADER+4,D4
;SECTOR ORDENTLICH DEKODIERT
BSR.S CHKSUMSECTOR
CMP.W D0,D4
BNE.S .ERR
TST.L D7
BNE.W .NEXTSEC
MOVEQ.L #0,D0
.END
MOVEM.L (A7)+,A2/A3/A4/A5/D2/D3/D4/D5/D6/D7
RTS
.ERR
MOVEQ.L #-1,D0
BRA.S .END
header ds.b $10
EVEN
CHKSUMSECTOR
MOVEQ.L #0,D0
MOVE.B HEADER+2,D0
MULU #$7D0,D0
LEA.L 0(A1,D0.L),A3
MOVEQ.L #0,D0
MOVE.W #$7D0/2-1,D1
.1 ADD.W (A3)+,D0
DBF D1,.1
RTS